// Licensed to Elasticsearch B.V under one or more agreements.
// Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
//
// ███╗   ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
// ████╗  ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
// ██╔██╗ ██║██║   ██║   ██║   ██║██║     █████╗
// ██║╚██╗██║██║   ██║   ██║   ██║██║     ██╔══╝
// ██║ ╚████║╚██████╔╝   ██║   ██║╚██████╗███████╗
// ╚═╝  ╚═══╝ ╚═════╝    ╚═╝   ╚═╝ ╚═════╝╚══════╝
// ------------------------------------------------
//
// This file is automatically generated.
// Please do not edit these files manually.
//
// ------------------------------------------------

using Elastic.Transport;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text.Json;
using System.Text.Json.Serialization;

#nullable restore
namespace Elastic.Clients.Elasticsearch.Ccr
{
	public sealed class CcrForgetFollowerRequestParameters : RequestParameters<CcrForgetFollowerRequestParameters>
	{
	}

	public sealed partial class CcrForgetFollowerRequest : PlainRequestBase<CcrForgetFollowerRequestParameters>
	{
		public CcrForgetFollowerRequest(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index))
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.CrossClusterReplicationForgetFollower;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		[JsonInclude]
		[JsonPropertyName("follower_cluster")]
		public string? FollowerCluster { get; set; }

		[JsonInclude]
		[JsonPropertyName("follower_index")]
		public Elastic.Clients.Elasticsearch.IndexName? FollowerIndex { get; set; }

		[JsonInclude]
		[JsonPropertyName("follower_index_uuid")]
		public string? FollowerIndexUuid { get; set; }

		[JsonInclude]
		[JsonPropertyName("leader_remote_cluster")]
		public string? LeaderRemoteCluster { get; set; }
	}

	public sealed partial class CcrForgetFollowerRequestDescriptor<TDocument> : RequestDescriptorBase<CcrForgetFollowerRequestDescriptor<TDocument>, CcrForgetFollowerRequestParameters>
	{
		internal CcrForgetFollowerRequestDescriptor(Action<CcrForgetFollowerRequestDescriptor<TDocument>> configure) => configure.Invoke(this);
		public CcrForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index))
		{
		}

		public CcrForgetFollowerRequestDescriptor(TDocument document) : this(typeof(TDocument))
		{
		}

		internal CcrForgetFollowerRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.CrossClusterReplicationForgetFollower;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public CcrForgetFollowerRequestDescriptor<TDocument> Index(Elastic.Clients.Elasticsearch.IndexName index)
		{
			RouteValues.Required("index", index);
			return Self;
		}

		private string? FollowerClusterValue { get; set; }

		private Elastic.Clients.Elasticsearch.IndexName? FollowerIndexValue { get; set; }

		private string? FollowerIndexUuidValue { get; set; }

		private string? LeaderRemoteClusterValue { get; set; }

		public CcrForgetFollowerRequestDescriptor<TDocument> FollowerCluster(string? followerCluster)
		{
			FollowerClusterValue = followerCluster;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor<TDocument> FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? followerIndex)
		{
			FollowerIndexValue = followerIndex;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor<TDocument> FollowerIndexUuid(string? followerIndexUuid)
		{
			FollowerIndexUuidValue = followerIndexUuid;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor<TDocument> LeaderRemoteCluster(string? leaderRemoteCluster)
		{
			LeaderRemoteClusterValue = leaderRemoteCluster;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (!string.IsNullOrEmpty(FollowerClusterValue))
			{
				writer.WritePropertyName("follower_cluster");
				writer.WriteStringValue(FollowerClusterValue);
			}

			if (FollowerIndexValue is not null)
			{
				writer.WritePropertyName("follower_index");
				JsonSerializer.Serialize(writer, FollowerIndexValue, options);
			}

			if (FollowerIndexUuidValue is not null)
			{
				writer.WritePropertyName("follower_index_uuid");
				JsonSerializer.Serialize(writer, FollowerIndexUuidValue, options);
			}

			if (!string.IsNullOrEmpty(LeaderRemoteClusterValue))
			{
				writer.WritePropertyName("leader_remote_cluster");
				writer.WriteStringValue(LeaderRemoteClusterValue);
			}

			writer.WriteEndObject();
		}
	}

	public sealed partial class CcrForgetFollowerRequestDescriptor : RequestDescriptorBase<CcrForgetFollowerRequestDescriptor, CcrForgetFollowerRequestParameters>
	{
		internal CcrForgetFollowerRequestDescriptor(Action<CcrForgetFollowerRequestDescriptor> configure) => configure.Invoke(this);
		public CcrForgetFollowerRequestDescriptor(Elastic.Clients.Elasticsearch.IndexName index) : base(r => r.Required("index", index))
		{
		}

		internal CcrForgetFollowerRequestDescriptor()
		{
		}

		internal override ApiUrls ApiUrls => ApiUrlsLookups.CrossClusterReplicationForgetFollower;
		protected override HttpMethod HttpMethod => HttpMethod.POST;
		protected override bool SupportsBody => true;
		public CcrForgetFollowerRequestDescriptor Index(Elastic.Clients.Elasticsearch.IndexName index)
		{
			RouteValues.Required("index", index);
			return Self;
		}

		private string? FollowerClusterValue { get; set; }

		private Elastic.Clients.Elasticsearch.IndexName? FollowerIndexValue { get; set; }

		private string? FollowerIndexUuidValue { get; set; }

		private string? LeaderRemoteClusterValue { get; set; }

		public CcrForgetFollowerRequestDescriptor FollowerCluster(string? followerCluster)
		{
			FollowerClusterValue = followerCluster;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor FollowerIndex(Elastic.Clients.Elasticsearch.IndexName? followerIndex)
		{
			FollowerIndexValue = followerIndex;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor FollowerIndexUuid(string? followerIndexUuid)
		{
			FollowerIndexUuidValue = followerIndexUuid;
			return Self;
		}

		public CcrForgetFollowerRequestDescriptor LeaderRemoteCluster(string? leaderRemoteCluster)
		{
			LeaderRemoteClusterValue = leaderRemoteCluster;
			return Self;
		}

		protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings)
		{
			writer.WriteStartObject();
			if (!string.IsNullOrEmpty(FollowerClusterValue))
			{
				writer.WritePropertyName("follower_cluster");
				writer.WriteStringValue(FollowerClusterValue);
			}

			if (FollowerIndexValue is not null)
			{
				writer.WritePropertyName("follower_index");
				JsonSerializer.Serialize(writer, FollowerIndexValue, options);
			}

			if (FollowerIndexUuidValue is not null)
			{
				writer.WritePropertyName("follower_index_uuid");
				JsonSerializer.Serialize(writer, FollowerIndexUuidValue, options);
			}

			if (!string.IsNullOrEmpty(LeaderRemoteClusterValue))
			{
				writer.WritePropertyName("leader_remote_cluster");
				writer.WriteStringValue(LeaderRemoteClusterValue);
			}

			writer.WriteEndObject();
		}
	}
}